package com.java.base.exercise.current;

import cn.hutool.db.DaoTemplate;
import sun.awt.windows.ThemeReader;

import java.util.Date;
import java.util.concurrent.TimeUnit;

/**
 * @Author RenPu
 * @Date 2021/8/31 16:56
 * @Version 1.0
 * @Description:
 **/
public class Thread_Sleep_Interrput implements Runnable {


    public static void main(String[] args) throws InterruptedException {
        Thread_Sleep_Interrput thread_sleep_interrput = new Thread_Sleep_Interrput();
        Thread thread = new Thread(thread_sleep_interrput);
        thread.start();
        Thread.sleep(6500);
        thread.interrupt();
    }


    @Override
    public void run() {

        for (int i = 0; i < 10; i++) {
            System.out.println(new Date());
            try {
                TimeUnit.MILLISECONDS.sleep(5000);
            } catch (InterruptedException e) {
                System.out.println("我被中断了！！！！");
                e.printStackTrace();
            }
        }

    }
}
